package sortAlgorithm;

/**
 * 冒泡排序
 * 
 * @author YNS
 *
 */
public class BubbleSort {
	public static int[] sort(int[] source) {
		int temp;
		for (int i = 0; i < source.length; i++) {
			for (int j = 0; j < source.length - 1 - i; j++) {
				if (source[j] > source[j + 1]) {
					temp = source[j];
					source[j] = source[j + 1];
					source[j + 1] = temp;
				}
				
				// System.out.println(Arrays.toString(source));
			}
		}

		return source;
	}
}
